package com.zzh.Demo;

import com.zzh.service.RemoteService;
import feign.Feign;
import feign.Request;
import feign.Retryer;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;

/**
 * @ClassName FeignDemo
 * @date 2021/4/7 17:07
 * @Version 1.0
 * @Description //FeignDemo
 * @USER root
 */
public class FeignDemo {

    public static void main(String[] args) {

        //基于json
        // encoder指定对象编码方式，decoder指定对象解码方式
        RemoteService service = Feign.builder()
                .encoder(new JacksonEncoder())
                .decoder(new JacksonDecoder())
                .options(new Request.Options(1000, 3500))
                .retryer(new Retryer.Default(5000, 5000, 3))
                .target(RemoteService.class, "http://localhost:8020/");

        System.out.println(service.findOrderByUserId(1));
    }
}
